package com.jielin.handling.controller.casegoods;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import com.jielin.handling.entity.unit.Organization;
import com.jielin.handling.entity.unit.OrganizationVo;
import com.jielin.handling.mapper.unit.UnitMapper;
import com.jielin.handling.service.policeplatform.PolicePlatformService;
import com.jielin.handling.service.unit.UnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import com.jielin.handling.Annotation.MyPower;
import com.jielin.handling.bean.AppResult;
import com.jielin.handling.entity.casegoods.CaseGoods;
import com.jielin.handling.entity.casegoods.CaseGoodsAuditResult;
import com.jielin.handling.entity.police.PoliceMan;
import com.jielin.handling.entity.vo.AllGoodsVo;
import com.jielin.handling.entity.vo.CaseVo;
import com.jielin.handling.entity.vo.GoodsAmountVo;
import com.jielin.handling.entity.vo.GoodsStateVo;
import com.jielin.handling.page.DataGrid;
import com.jielin.handling.service.casegoods.CaseGoodsAuditResultService;
import com.jielin.handling.service.casegoods.CaseGoodsService;
import com.jielin.handling.util.StringUtil;

import lombok.extern.slf4j.Slf4j;

/**
 * @author WR
 * @version 1.0
 * @Title：CaseGoodsController.java
 * @Description：涉案财物
 * @date 2019年9月5日 下午2:41:42
 */
@CrossOrigin
@RestController
@RequestMapping("/casegoods/")
@Slf4j
@MyPower(name = "涉案财物", url = "/casegoods")
public class CaseGoodsController {
    @Autowired
    CaseGoodsService caseGoodsService;
    @Autowired
    CaseGoodsAuditResultService caseGoodsAuditResultService;
    @Autowired
    PolicePlatformService policePlatformService;

    /**
     * 涉案财物主页审核通过率统计分析(年，月，日)
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "涉案财物审核通过率统计分析", url = "/findCaseGoodsAuditResultPassingRate", isPublic = true)
    @RequestMapping("/findCaseGoodsAuditResultPassingRate")
    public AppResult findCaseGoodsAuditResultPassingRate(@RequestBody CaseGoodsAuditResult caseGoodsAuditResult) {
        JSONObject data = new JSONObject();
        LinkedHashMap<String, Integer> resultMap = caseGoodsAuditResultService
                .findCaseGoodsAuditResultPassingRate(caseGoodsAuditResult);
        data.put("title", resultMap == null ? null : resultMap.keySet());
        data.put("value", resultMap == null ? null : resultMap.values());
        return AppResult.builder().setCode(200).setMsg("查询涉案财物审核通过率统计分析成功!").setData(data);
    }

    /**
     * 涉案财物主页物品类型统计分析
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "涉案财物物品类型统计分析", url = "/findCaseGoodsTypeRate", isPublic = true)
    @RequestMapping("/findCaseGoodsTypeRate")
    public AppResult findCaseGoodsTypeRate(@RequestBody CaseGoodsAuditResult caseGoodsAuditResult) {
        JSONObject data = new JSONObject();
        Map<String, Object> map = caseGoodsAuditResultService.findCaseGoodsTypeRate(caseGoodsAuditResult);
        data.put("title", map == null ? null : map.get("title"));
        data.put("value", map == null ? null : map.get("value"));
        return AppResult.builder().setCode(200).setMsg("查询涉案财物物品类型统计分析成功!").setData(data);
    }

    /**
     * 涉案财物主页物品状态统计分析
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "涉案财物物品状态统计分析", url = "/findCaseGoodsStatusRate", isPublic = true)
    @RequestMapping("/findCaseGoodsStatusRate")
    public AppResult findCaseGoodsStatusRate(@RequestBody CaseGoodsAuditResult caseGoodsAuditResult) {
        JSONObject data = new JSONObject();
        Map<String, List<Object>> map = caseGoodsAuditResultService.findCaseGoodsStatusRate(caseGoodsAuditResult);
        data.put("title", map == null ? null : map.get("title"));
        data.put("value", map == null ? null : map.get("value"));
        return AppResult.builder().setCode(200).setMsg("查询涉案财物物品状态统计分析成功!").setData(data);
    }

    /**
     * 查询物品审核列表
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "查询物品审核列表", url = "/findCaseGoodsAuditResult", isPublic = true)
    @RequestMapping("/findCaseGoodsAuditResult")
    public AppResult findCaseGoodsAuditResult(@RequestBody CaseGoodsAuditResult caseGoodsAuditResult) {
        JSONObject data = new JSONObject();
        data.put("value", caseGoodsAuditResultService.findCaseGoodsAuditResult(caseGoodsAuditResult));
        return AppResult.builder().setCode(200).setMsg("查询物品审核列表成功!").setData(data);
    }

    /**
     * 查询物品详细信息
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "查询物品详细信息", url = "/findCaseGoodsById", isPublic = true)
    @RequestMapping("/findCaseGoodsById")
    public AppResult findCaseGoodsById(String id) {
        JSONObject data = new JSONObject();
        data.put("value", caseGoodsAuditResultService.findCaseGoodsById(id));
        return AppResult.builder().setCode(200).setMsg("查询物品详细信息成功!").setData(data);
    }

    /**
     * 根据案件编号查询物品详细信息列表
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "根据案件编号查询物品详细信息列表", url = "/findCaseGoodsByCaseCode", isPublic = true)
    @RequestMapping("/findCaseGoodsByCaseCode")
    public AppResult findCaseGoodsByCaseCode(@RequestBody CaseGoodsAuditResult caseGoodsAuditResult) {
        JSONObject data = new JSONObject();
        data.put("value", caseGoodsAuditResultService.findCaseGoodsByCaseCode(caseGoodsAuditResult));
        return AppResult.builder().setCode(200).setMsg("查询物品详细信息列表成功!").setData(data);
    }

    /**
     * 物品审核状态修改
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "物品审核状态修改", url = "/updateCaseGoodsAuditResult", isPublic = true)
    @RequestMapping("/updateCaseGoodsAuditResult")
    public AppResult updateCaseGoodsAuditResult(@RequestBody CaseGoodsAuditResult caseGoodsAuditResult) {
        JSONObject data = new JSONObject();
        int i = caseGoodsAuditResultService.updateCaseGoodsAuditResult(caseGoodsAuditResult);
        data.put("value", i);
        if (i > 0) {
            return AppResult.builder().setCode(200).setMsg("改变物品审核状态成功!").setData(data);
        } else {
            return AppResult.builder().setCode(-1).setMsg("改变物品审核状态失败!").setData(data);
        }
    }

    /**
     * 查询涉案物品的操作日志列表
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "查询涉案物品的操作日志列表", url = "/findCaseGoodsLogs", isPublic = true)
    @RequestMapping("/findCaseGoodsLogs")
    public AppResult findCaseGoodsLogs(@RequestBody CaseGoodsAuditResult caseGoodsAuditResult) {
        JSONObject data = new JSONObject();
        data.put("value", caseGoodsAuditResultService.findCaseGoodsLogs(caseGoodsAuditResult));
        return AppResult.builder().setCode(200).setMsg("查询涉案物品的操作日志列表成功!").setData(data);
    }

    /**
     * 查询涉案物品的详细操作日志
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "查询涉案物品的详细操作日志", url = "/findCaseGoodsLogsById", isPublic = true)
    @RequestMapping("/findCaseGoodsLogsById")
    public AppResult findCaseGoodsLogsById(@RequestBody CaseGoodsAuditResult caseGoodsAuditResult) {
        JSONObject data = new JSONObject();
        data.put("value", caseGoodsAuditResultService.findCaseGoodsLogsById(caseGoodsAuditResult));
        return AppResult.builder().setCode(200).setMsg("查询涉案物品的操作日志列表成功!").setData(data);
    }

    /**
     * 查询该案件下的涉案物品的详细操作日志
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "查询该案件下的涉案物品的详细操作日志", url = "/findCaseGoodsLogsByCaseCode", isPublic = true)
    @RequestMapping("/findCaseGoodsLogsByCaseCode")
    public AppResult findCaseGoodsLogsByCaseCode(@RequestBody CaseGoodsAuditResult caseGoodsAuditResult) {
        JSONObject data = new JSONObject();
        data.put("value", caseGoodsAuditResultService.findCaseGoodsLogsByCaseCode(caseGoodsAuditResult));
        return AppResult.builder().setCode(200).setMsg("查询该案件下的涉案物品的详细操作日志成功!").setData(data);
    }

    /**
     * 查询涉案财物基本信息
     * <p>
     * 已整合到findCaseGoodsLogsById，findCaseGoodsLogsByCaseCode接口中
     *
     * @param com.jielin.handling.entity.casegoods.CaseGoodsAuditResult
     * @return
     */
    @MyPower(name = "查询涉案财物基本信息", url = "/findCaseInfoGoodsById", isPublic = true)
    @RequestMapping("/findCaseInfoGoodsById")
    public AppResult findCaseInfoGoodsById(String id) {
        JSONObject data = new JSONObject();
        data.put("value", caseGoodsAuditResultService.findCaseInfoGoodsById(id));
        return AppResult.builder().setCode(200).setMsg("查询涉案财物基本信息成功!").setData(data);
    }

    /**
     * 查询每个案件下涉案物品的数量
     */
    @MyPower(name = "查询每个案件下涉案物品的数量", url = "/selectGoodsAmountByCaseCode", isPublic = true)
    @ResponseBody
    @RequestMapping("/selectGoodsAmountByCaseCode")
    public AppResult selectGoodsAmountByCaseCode(@RequestBody JSONObject queryCondition) {
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        log.info("user query...");
        GoodsAmountVo vo = new GoodsAmountVo();
        int pageNum = queryCondition.getIntValue("pageNum");
        int pageSize = queryCondition.getIntValue("pageSize");
        vo.setQueryCondition(queryCondition);
        vo.setPage(pageNum, pageSize);
        if (StringUtil.isEmpty(vo.getUnitCodes())) {
            data.put("value", 0);
            appResult.setCode(-1);
            appResult.setMsg("参数为空");
            appResult.setData(data);
            return appResult;
        }
        String[] unitCodes = vo.getUnitCodes().split(",");
        vo.setArray(unitCodes);
        List<GoodsAmountVo> orderList = caseGoodsService.selectGoodsAmountByCaseCode(vo);
        // 用PageInfo对结果进行包装
        PageInfo<GoodsAmountVo> pageInfo = new PageInfo<>(orderList);
        DataGrid dataGrid = new DataGrid(pageInfo.getTotal(), pageInfo.getList());
        data.put("datagrid", dataGrid);
        appResult.setCode(200);
        appResult.setMsg("query success");
        appResult.setData(data);
        return appResult;
    }

    /**
     * 根据案件编号查询该案件下所有涉案物品最新的状态
     */
    @MyPower(name = "根据案件编号查询该案件下所有涉案物品最新的状态", url = "/selectGoodsTypeByCaseCode", isPublic = true)
    @ResponseBody
    @RequestMapping("/selectGoodsTypeByCaseCode")
    public AppResult selectGoodsTypeByCaseCode(String caseCode, int pageNum, int pageSize) {
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        log.info("user query...");
        List<GoodsStateVo> orderList = caseGoodsService.selectGoodsTypeByCaseCode(caseCode, pageNum, pageSize);
        // 用PageInfo对结果进行包装
        PageInfo<GoodsStateVo> pageInfo = new PageInfo<>(orderList);
        DataGrid dataGrid = new DataGrid(pageInfo.getTotal(), pageInfo.getList());
        data.put("datagrid", dataGrid);
        appResult.setCode(200);
        appResult.setMsg("query success");
        appResult.setData(data);
        return appResult;
    }

    /**
     * 对涉案物品状态批量操作
     */
    @MyPower(name = "对涉案物品状态批量操作", url = "/updateGoodsById", isPublic = true)
    @ResponseBody
    @RequestMapping("/updateGoodsById")
    public AppResult updateGoodsById(@RequestBody CaseGoodsAuditResult vo) {
        log.info("vo:{}", JSONObject.toJSONString(vo));
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        if (StringUtil.isEmpty(vo.getIds())) {
            data.put("value", 0);
            appResult.setCode(-1);
            appResult.setMsg("参数为空");
            appResult.setData(data);
            return appResult;
        }
        int i = caseGoodsService.updateGoodsById(vo);
        if (i != 0) {
            data.put("i", i);
            appResult.setCode(200);
            appResult.setMsg("操作成功");
            appResult.setData(data);
        } else {
            data.put("value", 0);
            appResult.setCode(-1);
            appResult.setMsg("操作失败!");
            appResult.setData(data);
        }
        return appResult;
    }

    /**
     * 对涉案物品状态撤销
     */
    @MyPower(name = "对涉案物品状态撤销", url = "/revokeGoodsById", isPublic = true)
    @ResponseBody
    @RequestMapping("/revokeGoodsById")
    public AppResult revokeGoodsById(@RequestBody AllGoodsVo vo) {
        log.info("vo:{}", JSONObject.toJSONString(vo));
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        if (StringUtil.isEmpty(vo.getIds())) {
            data.put("value", 0);
            appResult.setCode(-1);
            appResult.setMsg("参数为空");
            appResult.setData(data);
            return appResult;
        }
        int i = caseGoodsService.revokeGoodsById(vo);
        if (i != 0) {
            data.put("i", i);
            appResult.setCode(200);
            appResult.setMsg("撤销成功");
            appResult.setData(data);
        } else {
            data.put("value", 0);
            appResult.setCode(-1);
            appResult.setMsg("撤销失败!");
            appResult.setData(data);
        }
        return appResult;
    }

    /**
     * 对涉案物品的新增
     */
    @MyPower(name = "对涉案物品的新增", url = "/insertSelective", isPublic = true)
    @ResponseBody
    @RequestMapping("/insertSelective")
    public AppResult insertSelective(@RequestBody CaseGoods vo) {
        log.info("vo:{}", JSONObject.toJSONString(vo));
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        vo.setId(StringUtil.generatorUUID());
        int i = caseGoodsService.insertSelective(vo);
        if (i != 0) {
            data.put("id", vo.getId());
            appResult.setCode(200);
            appResult.setMsg("新增成功");
            appResult.setData(data);
        } else {
            data.put("value", 0);
            appResult.setCode(-1);
            appResult.setMsg("新增失败!");
            appResult.setData(data);
        }
        return appResult;
    }

    /**
     * 对涉案物品的删除
     */
    @MyPower(name = "对涉案物品的删除", url = "/deleteByPrimaryKey", isPublic = true)
    @ResponseBody
    @RequestMapping("/deleteByPrimaryKey")
    public AppResult deleteByPrimaryKey(String id) {
        log.info("id:{}", JSONObject.toJSONString(id));
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        int i = caseGoodsService.deleteByPrimaryKey(id);
        if (i != 0) {
            data.put("i", i);
            appResult.setCode(200);
            appResult.setMsg("删除成功");
            appResult.setData(data);
        } else {
            data.put("value", 0);
            appResult.setCode(-1);
            appResult.setMsg("删除失败!");
            appResult.setData(data);
        }
        return appResult;
    }

    /**
     * 对涉案物品的更新
     */
    @MyPower(name = "对涉案物品的更新", url = "/updateByPrimaryKeySelective", isPublic = true)
    @ResponseBody
    @RequestMapping("/updateByPrimaryKeySelective")
    public AppResult updateByPrimaryKeySelective(@RequestBody CaseGoods vo) {
        log.info("vo:{}", JSONObject.toJSONString(vo));
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        int i = caseGoodsService.updateByPrimaryKeySelective(vo);
        if (i != 0) {
            data.put("i", i);
            appResult.setCode(200);
            appResult.setMsg("更新成功");
            appResult.setData(data);
        } else {
            data.put("value", 0);
            appResult.setCode(-1);
            appResult.setMsg("更新失败!");
            appResult.setData(data);
        }
        return appResult;
    }

    /**
     * 根据id查询物品
     */
    @MyPower(name = "根据id查询物品", url = "/selectGoodsById", isPublic = true)
    @ResponseBody
    @RequestMapping("/selectGoodsById")
    public AppResult selectGoodsById(String id) {
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        log.info("user query...");
        CaseGoods orderList = caseGoodsService.selectGoodsById(id);
        // 用PageInfo对结果进行包装
        data.put("value", orderList);
        appResult.setCode(200);
        appResult.setMsg("查询涉案物品成功！");
        appResult.setData(data);
        return appResult;
    }

    /**
     * 首页逾期提醒
     */
    @MyPower(name = "首页逾期提醒", url = "/selectBeOverdue", isPublic = true)
    @ResponseBody
    @RequestMapping("/selectBeOverdue")
    public AppResult selectBeOverdue(String orgIds) {
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        log.info("user query...");
        List<CaseGoods> orderList = caseGoodsAuditResultService.selectBeOverdue(orgIds);
        // 用PageInfo对结果进行包装
        PageInfo<CaseGoods> pageInfo = new PageInfo<>(orderList);
        DataGrid dataGrid = new DataGrid(pageInfo.getTotal(), pageInfo.getList());
        data.put("datagrid", dataGrid);
        appResult.setCode(200);
        appResult.setMsg("query success");
        appResult.setData(data);
        return appResult;
    }

    /**
     * 首页存放位置数量统计
     */
    @MyPower(name = "首页存放位置数量统计", url = "/selectLocation", isPublic = true)
    @ResponseBody
    @RequestMapping("/selectLocation")
    public AppResult selectLocation(@RequestBody JSONObject queryCondition) {
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        log.info("user query...");
        GoodsAmountVo vo = new GoodsAmountVo();
        int pageNum = queryCondition.getIntValue("pageNum");
        int pageSize = queryCondition.getIntValue("pageSize");
        vo.setQueryCondition(queryCondition);
        vo.setPage(pageNum, pageSize);
        /*
         * if (StringUtil.isEmpty(vo.getUnitCodes())) { data.put("value", 0);
         * appResult.setCode(-1); appResult.setMsg("参数为空"); appResult.setData(data);
         * return appResult; } String[] unitCodes = vo.getUnitCodes().split(",");
         * vo.setArray(unitCodes);
         */
        List<GoodsAmountVo> orderList = caseGoodsAuditResultService.selectLocation(vo);
        // 用PageInfo对结果进行包装
        PageInfo<GoodsAmountVo> pageInfo = new PageInfo<>(orderList);
        DataGrid dataGrid = new DataGrid(pageInfo.getTotal(), pageInfo.getList());
        data.put("datagrid", dataGrid);
        appResult.setCode(200);
        appResult.setMsg("query success");
        appResult.setData(data);
        return appResult;
    }

    /**
     * 查询所有涉案物品
     */
    @MyPower(name = "查询所有涉案物品", url = "/selectGoods", isPublic = true)
    @ResponseBody
    @RequestMapping("/selectGoods")
    public AppResult selectGoods(@RequestBody JSONObject queryCondition) {
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        log.info("user query...");
        GoodsAmountVo vo = new GoodsAmountVo();
        int pageNum = queryCondition.getIntValue("pageNum");
        int pageSize = queryCondition.getIntValue("pageSize");
        vo.setQueryCondition(queryCondition);
        vo.setPage(pageNum, pageSize);
        if (StringUtil.isEmpty(vo.getUnitCodes())) {
            data.put("value", 0);
            appResult.setCode(-1);
            appResult.setMsg("参数为空");
            appResult.setData(data);
            return appResult;
        }
        String[] unitCodes = vo.getUnitCodes().split(",");
        vo.setArray(unitCodes);



        List<GoodsAmountVo> orderList = caseGoodsService.selectGoods(vo);
        // 用PageInfo对结果进行包装
        PageInfo<GoodsAmountVo> pageInfo = new PageInfo<>(orderList);
        DataGrid dataGrid = new DataGrid(pageInfo.getTotal(), pageInfo.getList());
        data.put("datagrid", dataGrid);
        appResult.setCode(200);
        appResult.setMsg("query success");
        appResult.setData(data);
        return appResult;
    }

    /**
     * 物品审核中申请民警/警号下拉框
     */
    @MyPower(name = "物品审核中申请民警/警号下拉框", url = "/selectDropList", isPublic = true)
    @ResponseBody
    @RequestMapping("/selectDropList")
    public AppResult selectDropList(@RequestBody JSONObject json) {
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        log.info("user query...");

        List<OrganizationVo> lists = caseGoodsAuditResultService.findUnitInfoByUnitCodeS(json.getString("unitcode"));
        List<String> strList = new ArrayList<>();
        for (OrganizationVo vo : lists) {
            strList.add(vo.getHandleUnitCode());
        }
        String str1 = "";
        String array[] = null;
        for (int i = 0; i < strList.size(); i++) {
            str1 += strList.get(i) + ",";
            array = str1.split(",");
        }

        List<PoliceMan> orderList = caseGoodsAuditResultService.selectDropList(array,json);
        // 用PageInfo对结果进行包装
        PageInfo<PoliceMan> pageInfo = new PageInfo<>(orderList);
        DataGrid dataGrid = new DataGrid(pageInfo.getTotal(), pageInfo.getList());
        data.put("datagrid", dataGrid);
        appResult.setCode(200);
        appResult.setMsg("query success");
        appResult.setData(data);
        return appResult;
    }






    /**
     * 物品审核中名称和案件编号下拉框
     */
    @MyPower(name = "物品审核中名称和案件编号下拉框", url = "/selectCodeAndName", isPublic = true)
    @ResponseBody
    @RequestMapping("/selectCodeAndName")
    public AppResult selectCodeAndName(String unitcode) {
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        log.info("user query...");
        List<CaseVo> orderList = caseGoodsAuditResultService.selectCodeAndName(unitcode);
        // 用PageInfo对结果进行包装
        PageInfo<CaseVo> pageInfo = new PageInfo<>(orderList);
        DataGrid dataGrid = new DataGrid(pageInfo.getTotal(), pageInfo.getList());
        data.put("datagrid", dataGrid);
        appResult.setCode(200);
        appResult.setMsg("query success");
        appResult.setData(data);
        return appResult;
    }

    /**
     * 逾期提醒查询
     */
    @MyPower(name = "逾期提醒查询", url = "/selectLateRemind", isPublic = true)
    @ResponseBody
    @RequestMapping("/selectLateRemind")
    public AppResult selectLateRemind(@RequestBody JSONObject unitcode) {
        AppResult appResult = new AppResult();
        JSONObject data = new JSONObject();
        log.info("user query...");

        List<OrganizationVo> lists = caseGoodsAuditResultService.findUnitInfoByUnitCodeS(unitcode.getString("unitcode"));
        List<String> strList = new ArrayList<>();
        for (OrganizationVo vo : lists) {
            strList.add(vo.getHandleUnitCode());
        }
        String str1 = "";
        String array[] = null;
        for (int i = 0; i < strList.size(); i++) {
            str1 += strList.get(i) + ",";
            array = str1.split(",");
        }

        List<Map<String,Object>> orderList = caseGoodsAuditResultService.selectLateRemind(array);
        // 用PageInfo对结果进行包装
        PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(orderList);
        DataGrid dataGrid = new DataGrid(pageInfo.getTotal(), pageInfo.getList());
        data.put("datagrid", dataGrid);
        appResult.setCode(200);
        appResult.setMsg("query success");
        appResult.setData(data);
        return appResult;
    }


}